home *** CD-ROM | disk | FTP | other *** search
/ PC Play 129 / pc play 129.iso / Demo / man2 / man2.exe / data / scripts / ponton_scripts.lua < prev    next >
Encoding:
Text File  |  2004-11-27  |  5.1 KB  |  140 lines

  1.  
  2. function units_ponton_setup()
  3.     units_setup(4,false,nil,ENET_GEOMETRY_PONTON_SHADOW)
  4.     local unit = uniGetExecutor()
  5.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNITBOARDTOTARGET,MATH_INFINITY,uniGetTarget()))
  6.     unit:addSimpleEffect(ENET_PONTON_GROUND):setVisibility(false,false)
  7.     unit:addSimpleEffect(ENET_EFFECT_PS_PONTON_SMOKE)
  8. end
  9.  
  10. function units_ponton_resetup()
  11.     units_setup(4,false,nil,ENET_GEOMETRY_PONTON_SHADOW)
  12.     local unit = uniGetExecutor()
  13.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNITBOARDTOTARGET,MATH_INFINITY,uniGetTarget()))
  14.     unit:addSimpleEffect(ENET_PONTON_GROUND):setVisibility(false,false)
  15.     unit:addSimpleEffect(ENET_EFFECT_PS_PONTON_SMOKE)
  16. end
  17.  
  18. function units_ponton_select()
  19.     units_select(12,1)
  20. end
  21.  
  22. function units_ponton_unselect()
  23.     units_unselect()
  24. end
  25.  
  26. function units_ponton_selectenemy()
  27.     uniGetExecutor():addSimpleEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY)
  28. end
  29.  
  30. function units_ponton_damaged()
  31.     uniGetExecutor():applyDamage(uniGetLife())
  32. end
  33.  
  34. function units_ponton_highlight()
  35.     uniGetExecutor():addEffectWithRadius(ENET_EFFECT_GEOMETRY_HIGHLIGHT,15)
  36. end
  37.  
  38. function units_ponton_explode()
  39.     units_explode_water1()
  40. end
  41.  
  42. function units_ponton_move()
  43.     local unit = uniGetExecutor()
  44.     local down_engine1 = unit:getBone(ENBT_FIRE1,0):addSimpleEffect(ENET_EFFECT_PS_PONTON_ENGINE)
  45.     local down_engine2 = unit:getBone(ENBT_FIRE1,1):addSimpleEffect(ENET_EFFECT_PS_PONTON_ENGINE)
  46.     local down_engine3 = unit:getBone(ENBT_FIRE1,2):addSimpleEffect(ENET_EFFECT_PS_PONTON_ENGINE)
  47.     local down_engine4 = unit:getBone(ENBT_FIRE1,3):addSimpleEffect(ENET_EFFECT_PS_PONTON_ENGINE)
  48.     unit:addAnimationToQueue(ENAT_GO,MATH_INFINITY)
  49.     waitDeath(unit:addMoveEffect(ENET_EFFECT_MOVE_LINEAR,100))
  50.  
  51.     down_engine1:suspendedDestroy(1.5)
  52.     down_engine2:suspendedDestroy(1.5)
  53.     down_engine3:suspendedDestroy(1.5)
  54.     down_engine4:suspendedDestroy(1.5)
  55.  
  56. end
  57.  
  58. function units_ponton_fire()
  59. end
  60.  
  61. function units_ponton_unload()
  62.     local unit = uniGetExecutor()
  63.     local pos = uniGetPosition()
  64.     waitDeath(unit:addRotationEffect(ENET_EFFECT_ROTATE_UNITBOARDTOTARGET,MATH_PI * 0.7,uniGetTarget()))
  65.     unit:addAnimationToQueue(ENAT_PREPAREFORFIRE1,1)
  66.     unit:setCurrentAnimationRepeatCount(0)
  67.     unit:addSimpleEffect(ENET_PONTON_GROUND):setVisibility(false,false)
  68. end
  69.  
  70. registerCommand(ENSCRIPTSET_PONTON,ENC_MOVE,"units_ponton_move")
  71. registerCommand(ENSCRIPTSET_PONTON,ENC_FIRE1,"units_ponton_fire")
  72. registerCommand(ENSCRIPTSET_PONTON,ENC_FIRE2,"units_ponton_fire")
  73. registerCommand(ENSCRIPTSET_PONTON,ENC_SELECT,"units_ponton_select")
  74. registerCommand(ENSCRIPTSET_PONTON,ENC_SELECTENEMY,"units_ponton_selectenemy")
  75. registerCommand(ENSCRIPTSET_PONTON,ENC_UNSELECT,"units_ponton_unselect")
  76. registerCommand(ENSCRIPTSET_PONTON,ENC_SETUP,"units_ponton_setup")
  77. registerCommand(ENSCRIPTSET_PONTON,ENC_RESETUP,"units_ponton_resetup")
  78. registerCommand(ENSCRIPTSET_PONTON,ENC_DAMAGED,"units_ponton_damaged")
  79. registerCommand(ENSCRIPTSET_PONTON,ENC_EXPLODE,"units_ponton_explode")
  80. registerCommand(ENSCRIPTSET_PONTON,ENC_HIGHLIGHT,"units_ponton_highlight")
  81. registerCommand(ENSCRIPTSET_PONTON,ENC_INSIDE,"units_inside")
  82. registerCommand(ENSCRIPTSET_PONTON,ENC_UNLOAD,"units_ponton_unload")
  83.  
  84. -- make description of unit
  85. desc = getEffectDescriptionP(ENET_UNIT_PONTON)
  86. desc.ClassID = ENCLASS_MESHINSTANCE
  87. desc.EffectClassType = ENECT_GEOMETRY
  88. desc.FileName = "ponton.rmd"
  89. desc.ScriptSet = ENSCRIPTSET_PONTON
  90. desc.MoveType = ENMOVE_SWIM
  91. desc.RenderType = ENRENDERTYPE_GEOMETRY
  92. desc.Material = ENMAT_RIGIDSKINNEDMESH
  93. desc.MaterialColors = units_materialcolors_human
  94.  
  95. -- shadow
  96. desc = getEffectDescriptionP(ENET_GEOMETRY_PONTON_SHADOW)
  97. desc.ClassID = ENCLASS_MESHINSTANCE
  98. desc.EffectClassType = ENECT_GEOMETRY
  99. desc.FileName = "ponton_shadow.rmd"
  100. desc.RenderType = ENRENDERTYPE_SHADOW
  101. desc.Material = ENMAT_SHADOW
  102. desc.MaterialColors = units_materialcolors_shadow
  103.  
  104. -- register new unit to logic
  105. unitDesc = logic_getUnitDescP(88)
  106. unitDesc.group = 1
  107. unitDesc.order = 2
  108. unitDesc.unit_res_id = ENET_UNIT_PONTON
  109. unitDesc.unit_icon_id = "Battleship_h_small_normal.dds"
  110. unitDesc.active_id = "Battleship_h_small_active.dds"
  111. unitDesc.pressed_id = "Battleship_h_small_pressed.dds"
  112. unitDesc.big_icon_id = "Pontoon_bridge_ico.dds"
  113. unitDesc.small_icon_id = "Battleship_u_stats.dds"
  114. unitDesc.HP = 1
  115. unitDesc.MP = 0
  116. unitDesc.WR = 0
  117. unitDesc.min_WR = 0
  118. unitDesc.WD = 0
  119. unitDesc.WR2 = 0
  120. unitDesc.min_WR2 = 0
  121. unitDesc.WD2 = 0
  122. unitDesc.ability = 3
  123. unitDesc.transport = 0
  124. unitDesc.value = 5
  125. unitDesc.race = 0
  126. unitDesc.fire_pause = 2.0
  127. unitDesc.move_pause = 1.0
  128. unitDesc.unit_info_scale = 0.04
  129. unitDesc.scn_name = "PONTON"
  130.  
  131.  
  132. ------------------------------------------------------------------------------------------------------
  133. ------------------------ effects related to unit------------------------------------------------------
  134. ------------------------------------------------------------------------------------------------------
  135. desc = getEffectDescription(ENET_EFFECT_GEOMETRY_VEGETATION_FURPALM)
  136. desc.FileName = "ponton_ground.smd"
  137. desc.effectUsageType = ENEUT_GENERIC
  138. desc.Geometry.isCollisionable = true
  139. changeEffect(ENET_PONTON_GROUND,desc)
  140.